//
//  ApiCenter+Comman.m
//  ZT_iOS
//
//  Created by Brigitte on 2017/2/22.
//  Copyright © 2017年 Brigitte. All rights reserved.
//

#import "ApiCenter+Comman.h"
#import "NormalPostRequest.h"
#import "UserRequest.h"
#import "ZTMacros.h"

@implementation ApiCenter (Comman)


// post请求
- (NSObject *)getNormalPostRequest:(NSString *)apiUrl parameters:(NSDictionary *)parameters success:(ApiCenterSuccessBlock)success failure:(ApiCenterFailureBlock)failure
{
    DLog(@"请求url = %@,请求参数 = %@",apiUrl,parameters);
    return [self request:[[NormalPostRequest alloc] initWithUrl:apiUrl query:parameters] reponseType:[BaseModel class] success:^(id model) {
        success(model);
    } failure:^(ErrorModel *model) {
        failure(model);
    }];    
}


- (NSObject *)getUserServiceRequest:(NSString *)apiUrl  parameters:(NSDictionary *)parameters success:(ApiCenterSuccessBlock)success failure:(ApiCenterFailureBlock)failure
{
    return [self request:[[UserRequest alloc] initWithUserServiceUrl:apiUrl params:parameters] reponseType:[BaseModel class] success:^(id model) {
        success(model);
    } failure:failure];
}


@end
